<?php
namespace app\command;
use app\framework\lib\Redis;
use app\service\CurrencyKline;
class klineSecond extends command
{
    public $cron = "* */5 * * * *";

    public function run()
    {
        $this->lock();
        $coins = CurrencyKline::getMarketList();
        foreach ($coins as $coin) {
            $key =sprintf("market.%susdt.kline.1sec", $coin);
             $data = Redis::get($key);
             if (empty($data)) {
                 continue;
             }

            $data = unserialize($data);

            CurrencyKline::update($coin,$data);
        }
        $this->unlock();
    }
}